<?php


$username =$_REQUEST["username"];
$password =$_REQUEST["password"];
$mysql =$mysql =new mysqli("localhost","root","","pengdandan");

$sql = "SELECT * FROM heibing WHERE username ='$username'";
$result =$mysql->query($sql);


if ($result->num_rows) {
  while ($result2=$result->fetch_assoc()) {
    // print_r($result2);
    session_start();
    $_SESSION['username']=$result2["username"];

    if ($result2["password"]==$password) {
      $_SESSION['password']=$result2["password"];
      $_SESSION['identity']=$result2["id"];
      $_SESSION['telephone']=$result2["telephone"];
      $_SESSION['name']=$result2["name"];
      $_SESSION['age']=$result2["age"];
      $_SESSION['sex']=$result2["sex"];
      $_SESSION['address']=$result2["address"];
      $_SESSION['signature']=$result2["signature"];
      echo "登陆成功";
      break;
    }else {
      echo "登陆失败";
      break;
    }
  }
}else {
  echo "没有您的账号，请先注册";
}

















 ?>
